import { TweenMax } from "../../../../../../com/greensock/TweenMax";
type int = number;
//class Lv70NpcTalkLeftDownMask
    
    export  class Lv70NpcTalkLeftDownMask /* flash.display.Sprite */
    {
        constructor()
        {
            
            this._masks = [];
            return;
        }

        public reInit(arg1: int, arg2: int, arg3: int, arg4: int, arg5: Function): void
        {
            this._num = arg1;
            this._lineHeight = arg3;
            this._fontSize = arg2;
            this._distanceX = arg4;
            this._onEnd = arg5;
            this._curIndex = 0;
            this._curStage = this.Stage_Tweening;
            this.initMasks();
            this.maskWorking();
            return;
        }

        public skip(): void
        {
            var loc1=0;
            var loc2=null;
            if (this._curStage == this.Stage_Stoping) 
            {
                return;
            }
            if (this._curStage != this.Stage_Tweening) 
            {
                if (this._curStage == this.Stage_AllShowing) 
                {
                    this.callbackEnd();
                }
            }
            else 
            {
                TweenMax.killAll();
                loc1 = 0;
                while (loc1 < this._masks.length) 
                {
                    loc2 = this._masks[loc1] as Object /* flash.display.Sprite */;
                    loc2.y = 0;
                    ++loc1;
                }
                this.tweenEnd();
            }
            return;
        }

        /* internal  */maskWorking(): void
        {
            if (this._curStage != this.Stage_Tweening) 
            {
                return;
            }
            if (this._curIndex >= this._num) 
            {
                this.tweenEnd();
                return;
            }
            var loc2;
            var loc3=((loc2 = this)._curIndex + 1);
            loc2._curIndex = loc3;
            var loc1=this._masks[(loc2 = this)._curIndex] as Object /* flash.display.Sprite */;
            loc1.y = -loc1.height;
            TweenMax.to(loc1, this._lineHeight / 150, {"y": 0, "onComplete": this.maskWorking});
            return;
        }

        /* internal  */tweenEnd(): void
        {
            this._curStage = this.Stage_AllShowing;
            this._timerId = flash.utils.setTimeout(this.callbackEnd, 2000);
            return;
        }

        /* internal  */callbackEnd(): void
        {
            flash.utils.clearTimeout(this._timerId);
            this._timerId = -1;
            this._curStage = this.Stage_Stoping;
            if (this._onEnd != null) 
            {
                this._onEnd.apply();
                this._onEnd = null;
            }
            return;
        }

        /* internal  */initMasks(): void
        {
            var loc2=null;
            var loc1=0;
            while (loc1 < this._num) 
            {
                if (loc1 < this._masks.length) 
                {
                    loc2 = this._masks[loc1] as Object /* flash.display.Sprite */;
                    loc2.graphics.clear();
                }
                else 
                {
                    loc2 = new Object /* flash.display.Sprite */();
                    this._masks.push(loc2);
                    this.addChild(loc2);
                }
                loc2.graphics.beginFill(16777215, 1);
                loc2.graphics.drawRect(0, 0, this._fontSize + 3, this._lineHeight + 2);
                loc2.graphics.endFill();
                loc2.x = (this._fontSize + this._distanceX) * (-loc1);
                loc2.y = -loc2.height;
                ++loc1;
            }
            return;
        }

        /* internal */ /* const */Stage_Stoping: int=0;

        /* internal */ /* const */Stage_Tweening: int=1;

        /* internal */ /* const */Stage_AllShowing: int=2;

        /* internal */ /* var */_masks: Array<any>;

        /* internal */ /* var */_curIndex: int;

        /* internal */ /* var */_onEnd: Function;

        /* internal */ /* var */_fontSize: int;

        /* internal */ /* var */_lineHeight: int;

        /* internal */ /* var */_num: int;

        /* internal */ /* var */_distanceX: int;

        /* internal */ /* var */_curStage: int=0;

        /* internal */ /* var */_timerId: int=-1;
    }
